﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ADONETDataServicesExtension.Utils;

namespace ADONETDataServicesExtension.Parsing
{
    public class Token : FrameworkEncapsulatedType<object>
    {
        internal string FrameworkTypeName = "System.Data.Services.Parsing.Token";

        public Token(object token)
            : base(token)
        {
        }

        public string Text
        {
            get
            {
                return ReflectionHelper.GetField<string>(FrameworkTypeName, "Text", FrameworkObject);
            }
            set
            {
                ReflectionHelper.SetField(FrameworkTypeName, "Text", FrameworkObject, value);
            }
        }

        public int Position
        {
            get
            {
                return ReflectionHelper.GetField<int>(FrameworkTypeName, "Position", FrameworkObject);
            }
            set
            {
                ReflectionHelper.SetField(FrameworkTypeName, "Position", FrameworkObject, value);
            }
        }

        public bool IsComparisonOperator
        {
            get
            {
                return ReflectionHelper.GetProperty<bool>(FrameworkTypeName, "IsComparisonOperator", FrameworkObject);
            }
        }

        public bool IsEqualityOperator
        {
            get
            {
                return ReflectionHelper.GetProperty<bool>(FrameworkTypeName, "IsEqualityOperator", FrameworkObject);
            }
        }

        public bool IdentifierIs(string id)
        {
            return ReflectionHelper.InvokeMethod<bool>(FrameworkTypeName, "IdentifierIs", FrameworkObject, id);
        }

        public int Id
        {
            get
            {
                return ReflectionHelper.GetField<int>(FrameworkTypeName, "Id", FrameworkObject);
            }
        }

        public string GetIdentifier()
        {
            return ReflectionHelper.InvokeMethod<string>(FrameworkTypeName, "GetIdentifier", FrameworkObject);
        }
    }
}
